﻿using System.Collections.Generic;

namespace Isuka.Iteration
{
    public class IteratorEqualityComparer
        : IEqualityComparer<IIterator>
    {
        public static bool Equals(IIterator x, IIterator y)
        {
            if (x == y)
            {
                return true;
            }
            else if (x == null)
            {
                return y.Equals(x);
            }
            else
            {
                return x.Equals(y);
            }
        }

        #region IEqualityComparer<IIterator> メンバー

        bool IEqualityComparer<IIterator>.Equals(IIterator x, IIterator y)
        {
            return Equals(x, y);
        }

        int IEqualityComparer<IIterator>.GetHashCode(IIterator obj)
        {
            return obj.GetHashCode();
        }

        #endregion
    }
}
